<?php


/**
 * Framework_Pager
 *
 * @author      Ian Szewczyk <roamzero@gmail.com>
 * @copyright   (c) 2007 Ian Szewczyk. All rights reserved.
 * @license     http://www.opensource.org/licenses/bsd-license.php
 * @package Framework
 * @filesource
 */

require_once "Pager/Pager.php";

/**
 * Framework_Pager
 *
 * A basic wrapper class for PEAR's Pager
 *
 * @author Ian Szewczyk <roamzero@gmail.com>
 * @link http://pear.php.net/manual/en/package.html.pager.php
 * @package Framework
 * 
 */
abstract class Framework_Pager
{
    /**
     * factory
     *
     * @access 		public
     * @param 		string $site Name of site to load
     * @return 		mixed Instance of Pager, PEAR::error on failure
     * @static
     */
    static public function factory($options)
    {
        
    	$defaultParams = array(
    		'mode' => 'Sliding', 
    		'perPage' => 10, 
			'delta' => 2, 
			//'totalItems' => 0, 
			'currentPage' => 1, 
			'append' => false, 
			'path' => Framework::$request->getHTTPPath(),
			'fileName' => '/%d'
    	);
    	
		foreach ($defaultParams AS $key => $value) {
			if (!array_key_exists($key,$options)) {
				$options[$key] = $value;
			}
		}
    	

        return Pager::factory($options);
    }
}

?>
